<include file="public@header" />
</head>
<body>
<div class="wrap">
  <ul class="nav nav-tabs">
    <li><a href="{:url('admin/vipExplain/index')}">列表</a></li>
    <li class="active"><a>编辑</a></li>
  </ul>
  <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('admin/vipExplain/edit')}">
    <input type="hidden" name="id" value="{$data['id']}">
    <input type="hidden" name="lang_id" value="{$data['lang_id']}">

    <div class="form-group">
      <label for="name" class="col-sm-2 control-label"><span class="form-required">*</span>权益名称</label>
      <div class="col-md-6 col-sm-10">
        <input type="text" name="name" id="name" class="form-control" value="{$data['name']}" />
      </div>
    </div>

    <div class="form-group">
      <label for="name_cn" class="col-sm-2 control-label"><span class="form-required">*</span>权益中文名称</label>
      <div class="col-md-6 col-sm-10">
        <input type="text" name="name_cn" id="name_cn" class="form-control" value="{$data['name_cn']}" />
      </div>
    </div>

    <div class="form-group">
      <label for="sort" class="col-sm-2 control-label"><span class="form-required">*</span>排序</label>
      <div class="col-md-6 col-sm-10">
        <input type="text" name="sort" id="sort" class="form-control" value="{$data['sort']}" />
      </div>
    </div>

    <div class="form-group">
      <label class="col-sm-2 control-label">图标</label>
      <div class="col-md-6 col-sm-10">
        <input type="hidden" name="icon_src" id="iconSrc" value="{$data['icon_src']}">
        <a href="javascript:uploadOneImage('图片上传','#iconSrc');">

          <if condition="empty($data.icon_src)">
            <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                 id="iconSrc-preview"
                 style="cursor: pointer;max-width:100px;max-height:100px;"/>
            <else/>
            <img src="{:get_upload_path($data.icon_src)}"
                 id="thumbnail-preview"
                 style="cursor: pointer;max-width:100px;max-height:100px;"/>
          </if>
        </a>
        <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片"> 建议尺寸： 300 X 300
      </div>
    </div>

    <div class="form-group">
      <label for="explain" class="col-sm-2 control-label"><span class="form-required">*</span>权益内容</label>
      <div class="col-md-6 col-sm-10">
        <textarea name="explain" id="explain" class="form-control" rows="10">{$data['explain']}</textarea>
      </div>
    </div>

    <div class="form-group">
      <div class="col-sm-offset-2 col-sm-10">
        <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
        <a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
      </div>
    </div>
  </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
  (function(){
    $('.btn-cancel-thumbnail').click(function () {
      $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
      $('#thumbnail').val('');
    });

    $('.btn-cancel-thumbnail2').click(function () {
      $('#thumbnail2-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
      $('#thumbnail2').val('');
    });
  })()

</script>
</body>
</html>